import axios from "axios";
// import { getToken } from "./user-token";


const instance = axios.create();


// Add a request interceptor
instance.interceptors.request.use(function (config) {
    // config.headers['Authorization'] = `Bearer ${getToken()}`
    return config;
}, function (error) {
    // Do something with request error
    return Promise.reject(error);
});
// Add a response interceptor
instance.interceptors.response.use(function (response) {
    if (response.status === 200) {
        return response.data
    }
    return response;
}, function (error) {
    // Any status codes that falls outside the range of 2xx cause this function to trigger
    // Do something with response error
    return Promise.reject(error);
});

export default instance